<template>
  <div id="data-view">
    <dv-full-screen-container>
      <span v-show="!isFull" class="full" @click="enterFullscreen">
        <img src="@/assets/datav/full.png" alt="" />
      </span>
      <span v-show="isFull" class="full" @click="enterout">
        <img src="@/assets/datav/out.png" alt="" />
      </span>
      <top-header />

      <div class="main-content">
        <div class="block-left">
          <div class="block-left-top">
            <ltChart />
          </div>
          <div class="block-left-content">
            <lcChart />
          </div>
          <div class="block-left-bottom">
            <lbChart />
          </div>
        </div>
        <div class="block-content">
          <div class="block-content-top">
            <div class="card-center">
              <div class="card turnover">
                <span>{{ $t('yingYeE') }}</span>
                <dv-digital-flop :config="turnoverDigital" />
              </div>
              <div class="card order">
                <span>{{ $t('dingDan') }}</span>
                <dv-digital-flop :config="orderDigital" />
              </div>
            </div>
            <div class="map-center">
              <mapcnt />
            </div>
          </div>
          <div class="block-content-bottom">
            <scrollBoard />
          </div>
        </div>
        <div class="block-right">
          <div class="block-right-top">
            <rtChart />
          </div>
          <div class="block-right-content">
            <rcChart />
          </div>
          <div class="block-right-bottom">
            <rbChart />
          </div>
        </div>
      </div>
      <div class="decoration-buttom"></div>
    </dv-full-screen-container>
  </div>
</template>

<script>
import topHeader from '@/components/datav/topHeader';
import ltChart from '@/components/datav/ltChart';
import lcChart from '@/components/datav/lcChart';
import lbChart from '@/components/datav/lbChart';

import rtChart from '@/components/datav/rtChart';
import rcChart from '@/components/datav/rcChart';
import rbChart from '@/components/datav/rbChart';
import mapcnt from '@/components/datav/map';
import scrollBoard from '@/components/datav/scrollBoard';
export default {
  name: 'DataView',
  components: {
    topHeader,
    scrollBoard,
    mapcnt,
    ltChart,
    lcChart,
    lbChart,
    rtChart,
    rcChart,
    rbChart,
  },
  data() {
    return {
      isFull: false,
      turnoverDigital: {
        number: [4959773],
        content: '{nt}₸',
        textAlign: 'right',
        style: {
          fontSize: 20,
          fill: '#fff',
        },
        formatter: this.formatter,
      },
      orderDigital: {
        number: [123456],
        content: `{nt}`,
        textAlign: 'right',
        style: {
          fontSize: 20,
          fill: '#fff',
        },
        formatter: this.formatter,
      },
    };
  },
  mounted() {},
  methods: {
    enterFullscreen() {
      this.isFull = true;
      const element = document.documentElement;
      if (element.requestFullscreen) {
        element.requestFullscreen();
      } else if (element.mozRequestFullScreen) {
        element.mozRequestFullScreen();
      } else if (element.webkitRequestFullscreen) {
        element.webkitRequestFullscreen();
      } else if (element.msRequestFullscreen) {
        element.msRequestFullscreen();
      }
    },
    enterout() {
      console.log(666);
      this.isFull = false;
      //  退出全屏
      if (document.exitFullscreen) {
        document.exitFullscreen();
      } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
      } else if (document.webkitCancelFullScreen) {
        document.webkitCancelFullScreen();
      } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
      }
    },
    formatter(number) {
      const numbers = number.toString().split('').reverse();
      const segs = [];

      while (numbers.length) segs.push(numbers.splice(0, 3).join(''));

      return segs.join(',').split('').reverse().join('');
    },
  },
};
</script>

<style lang="scss" scoped>
#data-view {
  width: 100%;
  height: 100%;
  background-color: #000;
  color: #fff;

  #dv-full-screen-container {
    background: url('~@/assets/datav/bg.jpg') no-repeat top center;
    background-size: 1462px 829px;
    box-shadow: 0 0 3px blue;
    display: flex;
    flex-direction: column;
    bottom: 0 !important;
    height: 100vh !important;
    overflow-y: auto;
  }

  .main-content {
    position: relative;
    z-index: 10;
    margin: -90px 32px 0;
    flex: 1;
    display: flex;
    height: calc(100% - 30px);
    min-height: 978px;
    .block-left {
      width: 28%;
      &-top {
        height: 35%;
      }
      &-content {
        height: 33%;
      }
      &-bottom {
        height: 32%;
      }
    }
    .block-content {
      flex: 1;
      &-top {
        height: 68%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }
      &-bottom {
        height: 32%;
      }
    }
    .block-right {
      width: 28%;
      &-top {
        height: 35%;
      }
      &-content {
        height: 33%;
      }
      &-bottom {
        height: 32%;
      }
    }
  }

  .decoration-buttom {
    background: url('~@/assets/datav/foot.png') no-repeat center center;
    background-size: 100% 16px;
    height: 16px;
    margin: 0 32px;
  }
  ::v-deep {
    .sub-title {
      background-image: url('~@/assets/datav/title.png');
      background-size: 100% 100%;
      height: 50px;
      padding-left: 13%;
      display: flex;
      align-items: center;
      font-size: 18px;
      font-family: Source Han Sans;
      text-shadow: 0px 0px 9px #159aff, 0px 2px 4px rgba(0, 0, 0, 0.5);
    }
  }
}

.card-center {
  margin-top: 5%;
  display: flex;
  justify-content: center;
  > div {
    margin: 0 56px;
    width: 285px;
    height: 43px;
    line-height: 43px;
    display: flex;
    justify-content: space-between;
    padding-right: 16px;
    padding-left: 51px;
    font-size: 16px;
    .dv-digital-flop {
      width: 160px;
    }

    &.turnover {
      background: url('~@/assets/datav/turnover.png');
      background-size: 100% 100%;
      color: #159aff;
    }
    &.order {
      background: url('~@/assets/datav/order.png');
      background-size: 100% 100%;
      color: #d0aa43;
    }
  }
}

.map-center {
  margin-top: 4%;
  display: flex;
  flex: 1;
  align-items: center;
}

.full {
  position: absolute;
  right: 20px;
  top: 20px;
  cursor: pointer;
  z-index: 99;
  > img {
    width: 20px;
    height: 20px;
  }
}
</style>
